package org.dxy.domain.game.command;

import org.dxy.domain.game.adapter.event.EventQueue;
import org.dxy.domain.game.model.aggregate.GameAggregate;
import org.dxy.domain.game.repository.GameRepository;
import org.springframework.stereotype.Component;

@Component
public class GameStartCommandHandler {
    private GameRepository gameRepository;
//    private EventQueue eventQueue;

    void  handle(EventQueue eventQueue, GameStartCommand gameStartCommand){
        GameAggregate gameAggregate = gameRepository.findById(gameStartCommand.getGameId());
        gameAggregate.handle(eventQueue, gameStartCommand);
        gameRepository.save(gameAggregate);
    }
}
